import http from './http'
import Vue from "vue";

/**
 * student  API 方法集合
 */
const api = {
     /**
     * 获取所有人员信息
     * @param {Object} filterConditions - 筛选条件
     * @returns {Promise}
     */
     getStudents: (filterConditions) => {
        return http.post('/student/getStudents', filterConditions)
            .catch(error => {
                console.error('获取人员信息失败:', error);
                throw error;
            });
    },
    /**
     * 获取学生综合评价雷达图
     * @returns {Promise}
     */
    getStudentRadarScores: data => {
        return http.get(`student/getStudentRadarScores?name=${data.name}&classes=${data.classes}`)
            .catch(error => {
                console.error('获取雷达图失败:', error);
                throw error;
            });
    },
    /**
     * 获取学生个人成绩
     * @returns {Promise}
     */
    getStudentAvgScores: data => {
        return http.get(`student/getStudentAvgScore?name=${data.name}&classes=${data.classes}`)
            .catch(error => {
                console.error('获取个人成绩失败:', error);
                throw error;
            });
    },
    /**
     * 获取成绩模块学生个人学科成绩
     * @returns {Promise}
     */
    getStudyScore: data => {
        return http.get(`student/getStudyScore?name=${data.name}&classes=${data.classes}`)
            .catch(error => {
                console.error('获取成绩模块个人学科成绩失败:', error);
                throw error;
            });
    },
    /**
     * 获取作业评级情况
     * @returns {Promise}*/
     getStudyHomework: data => {
        return http.get(`student/getStudyHomework?name=${data.name}&classes=${data.classes}`)
            .catch(error => {
                console.error('获取作业评级情况失败:', error);
                throw error;
            });
    },
        /**
     * 获取自主学术讲座情况
     * @returns {Promise}
    */
     getStudyLecture: data => {
        return http.get(`student/getStudyLecture?name=${data.name}&classes=${data.classes}`)
            .catch(error => {
                console.error('获取主学术讲座失败:', error);
                throw error;
            });
    },
    /**
     * 获取自主学习讲座
     * @returns {Promise}
     */
    getLectures: data => {
        return http.get(`student/getStudyLecture?name=${data.name}&classes=${data.classes}`)
            .catch(error => {
                console.error('获取自主学习讲座失败:', error);
                throw error;
            });
    },
    /**
     * 获取图书馆记录
     * @returns {Promise}
     */
    getStudyLibrary: data => {
        return http.get(`student/getStudyLibrary?name=${data.name}&classes=${data.classes}`)
            .catch(error => {
                console.error('获取图书馆失败:', error);
                throw error;
            });
    },
    /**
     * 获取晚加班记录
     * @returns {Promise}
     */
    getOvertimeRecords: (data) => {
        return http.get(`student/getStudyOvertime?name=${data.name}&classes=${data.classes}`)
            .catch(error => {
                console.error('获取晚加班记录失败:', error);
                throw error;
            });
    },
     /**
     * 获取个人主动回答问题
     * @returns {Promise}
     */
     getStudyProactive: data => {
        return http.get(`student/getStudyProactive?name=${data.name}&classes=${data.classes}`)
            .catch(error => {
                console.error('获取个人主动回答问题失败:', error);
                throw error;
            });
    },
     /**
     * 获取饭卡消费数据问题
     * @returns {Promise}
     */
     getLifeMealcard: data => {
        return http.get(`student/getLifeMealcard?name=${data.name}&classes=${data.classes}`)
            .catch(error => {
                console.error('获取饭卡消费数据失败:', error);
                throw error;
            });
    },
    /** 
     * 获取个人内务
     * @returns {Promise}
     */
    getLifeHousekeeping: data => {
        return http.get(`student/getLifeHousekeeping?name=${data.name}&classes=${data.classes}`)
            .catch(error => {
                console.error('获取个人内务失败:', error);
                throw error;
            });
    },
    /**
     * 获取公差情况
     * @returns {Promise}
     */
    getLifeBusiness: data => {
        return http.get(`student/getLifeBusiness?name=${data.name}&classes=${data.classes}`)
            .catch(error => {
                console.error('获取公差失败:', error);
                throw error;
            });
    },
    /**
     * 获取个人请假情况
     * @returns {Promise}*/
    getLifeLeave: data => {
        return http.get(`student/getLifeLeave?name=${data.name}&classes=${data.classes}`)
            .catch(error => {
                console.error('获取个人请假情况:', error);
                throw error;
            });
    },
    /**
     * 获取个人外出情况
     * @returns {Promise}*/
    getLifeOut: data => {
        return http.get(`student/getLifeOut?name=${data.name}&classes=${data.classes}`)
            .catch(error => {
                console.error('获取个人外出情况:', error);
                throw error;
            });
    },
    /**
    * 获取参与活动情况
    * @returns {Promise}*/
    getSocialActivities: data => {
       return http.get(`student/getSocialActivities?name=${data.name}&classes=${data.classes}`)
           .catch(error => {
               console.error('获取个人参与活动情况:', error);
               throw error;
           });
   },
   /**
    * 获取个人JRFJ检查情况
    * @returns {Promise}*/
   getThoughtJRFJ: data => {
    return http.get(`student/getThoughtJRFJ?name=${data.name}&classes=${data.classes}`)
        .catch(error => {
            console.error('获取个人JRFJ检查情况:', error);
            throw error;
        });
},
/**
    * 获取个人纠察检查情况
    * @returns {Promise}*/
getThoughtPicket: data => {
    return http.get(`student/getThoughtPicket?name=${data.name}&classes=${data.classes}`)
        .catch(error => {
            console.error('获取个人纠察情况:', error);
            throw error;
        });
},
/**
    * 获取个人保密检查情况
    * @returns {Promise}*/
getThoughtSecurity: data => {
    return http.get(`student/getThoughtSecurity?name=${data.name}&classes=${data.classes}`)
        .catch(error => {
            console.error('获取个人保密检查情况:', error);
            throw error;
        });
},
/**
    * 获取个人体测情况
    * @returns {Promise}*/
getHealthSportstest: data => {
    return http.get(`student/getHealthSportstest?name=${data.name}&classes=${data.classes}`)
        .catch(error => {
            console.error('获取个人体测情况:', error);
            throw error;
        });
},
/**
    * 获取个人就诊情况
    * @returns {Promise}*/
getHealthVisitdoctor: data => {
    return http.get(`student/getHealthVisitdoctor?name=${data.name}&classes=${data.classes}`)
        .catch(error => {
            console.error('获取个人就诊情况:', error);
            throw error;
        });
},
/**
    * 获取个人基本信息
    * @returns {Promise}*/
getStuByNameClass: data => {
    return http.get(`student/getStuByNameClass?name=${data.name}&classes=${data.classes}`)
        .catch(error => {
            console.error('获取个人基本信息:', error);
            throw error;
        });
},
/**
    * 获取个人详情信息（字段为id）
    * @returns {Promise}*/
getStudentInfo: data => {
    return http.get(`/student/getStudentInfo?id=${data.id}`)
        .catch(error => {
            console.error('获取个人详情信息:', error);
            throw error;
        });
}
    
}

// 将 API 方法挂载到 Vue 原型上
Vue.prototype.$studentapi = api;

export default api;
